package com.lei.springbootpractice.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value="products")
public class ProductsPojo {
    //TODO:是主键也是外键
    @TableId(value="product_id",type= IdType.ASSIGN_ID)
    private String productId;
    //TODO:外键
    @TableField(value="category_id")
    private String categoryId;

    @TableField(value="product_name")
    private String productName;
    //TODO:思考一下如何存放图片和描述
    @TableField(value="price")
    private double price;
    @TableField(value = "description")
    private String description;

    @TableField(value="photo")
    private String photo;
    @TableField(value="rest")
    private int rest;

    @TableField(exist = false)
    private String parentCategoryName; // 父分类名称

    @TableField(exist = false)
    private String categoryName; // 子分类名称

    @TableField(exist = false)
    private int reviewCount; // 评价数量

    @TableField(exist = false)
    private double averageRating; // 平均评分


    @TableField(exist = false)
    private List<ReviewPojo> reviews; // 商品评价列表

    // ... 其他 getter/setter 方法

    public List<ReviewPojo> getReviews() {
        return reviews;
    }

    public void setReviews(List<ReviewPojo> reviews) {
        this.reviews = reviews;
    }


    // Getters and Setters
    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public int getRest() {
        return rest;
    }

    public void setRest(int rest) {
        this.rest = rest;
    }

    public String getParentCategoryName() {
        return parentCategoryName;
    }

    public void setParentCategoryName(String parentCategoryName) {
        this.parentCategoryName = parentCategoryName;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public int getReviewCount() {
        return reviewCount;
    }

    public void setReviewCount(int reviewCount) {
        this.reviewCount = reviewCount;
    }

    public double getAverageRating() {
        return averageRating;
    }

    public void setAverageRating(double averageRating) {
        this.averageRating = averageRating;
    }
}